/**
 * 智慧小区管理系统 - 路由类型定义
 * @author Wu.Liang
 * @date 2024-12-21
 */
import type { RouteRecordRaw, RouteMeta as VueRouteMeta } from 'vue-router'

// 扩展路由元信息类型
declare module 'vue-router' {
    interface RouteMeta {
        title?: string
        icon?: string
        hidden?: boolean
        requireAuth?: boolean
        requiresAuth?: boolean
        permission?: string
        keepAlive?: boolean
        noCache?: boolean
        affix?: boolean
        breadcrumb?: boolean
        activeMenu?: string
        roles?: string[]
    }
}

// 路由元信息类型别名
export type RouteMeta = VueRouteMeta

// 菜单项类型
export interface MenuItem {
    path: string
    name: string
    component?: string
    redirect?: string
    meta: {
        title: string
        icon?: string
        hidden?: boolean
        requireAuth?: boolean
        permission?: string
        keepAlive?: boolean
        roles?: string[]
    }
    children?: MenuItem[]
}

// 路由配置类型
export interface RouteConfig {
    path: string
    name?: string
    component?: unknown
    redirect?: string
    meta?: RouteMeta
    children?: RouteConfig[]
    hidden?: boolean
    alwaysShow?: boolean
}

// 权限路由类型
export interface PermissionRoute {
    path: string
    name: string
    component: string
    meta: {
        title: string
        icon?: string
        permission: string
        roles?: string[]
    }
    children?: PermissionRoute[]
}

// 面包屑导航类型
export interface BreadcrumbItem {
    title: string
    path?: string
    query?: Record<string, any>
}

// 标签页类型
export interface TabItem {
    title: string
    path: string
    name: string
    query?: Record<string, any>
    params?: Record<string, any>
    affix?: boolean
}
